Command Line Support

Overview

Capella provides the capacity to launch actions from command line. Potential actions are Model Validation, Model Migration, HTML Production, Refresh Representations, Remove Hidden Elements from Representations and Export Representations as Images.

The core mechanism provides the following parameters:

Name Category Description
appid mandatory defines the id of the command line application to launch. Command line applications are plugins that extend the core mechanism (e.g. Model Validation).
data optional defines the path to the workspace.
input mandatory defines a list of the relative paths (to the workspace) of the Eclipse Projects or *.aird files to use as input of the command line. The list has to be placed into quotes "" and separated by a | character. Use /all to specify that all projects in the workspace are used as input.
import optional defines a list of the path of the Eclipse projects to import into the workspace before doing the actual job. The list has to be placed into quotes "" and separated by a | character.
importAll optional Specifies an absolute path to a folder containing Eclipse projects, either as directories with a .project file or as ZIP archives containing multiple project directories, each with its own .project file. Projects stored as directories are migrated in place. ZIP archives are extracted into the workspace, where the extracted projects are then migrated.
forceimport optional unreference/delete exiting Project from the workspace while importing projects using command line. Without this option, an error is logged if a project with the same name than the imported project exists already in the workspace.
outputfolder optional defines the relative path (to the workspace) of the output folder.
exportProjects optional defines the list of Eclipse projects to export by their names. The list have to be placed into quotes "" and separated by a | character. Use /all if all the projects in the workspace must be exported. The export behavior depends of -exportCopy and -singleZip. If no export mode is provided, all projects are zipped in the -exportTarget folder. This parameter must be used with -exportTarget to specify where projects are exported.
singleZip optional defines the Export Mode as a single Archive with all projects. -exportTarget parameter must be a Zip file.
exportCopy optional defines the Export Mode as a copy of all projects without compression. -exportTarget parameter must be a folder.
exportTarget optional defines the location to export in. The location must be a Zip file if -singleZip is defined. Otherwise the location must be a folder.
exportZip optional (Deprecated, see exportProjects option)

defines a list of the relative paths of the Eclipse projects to export as zip. The list have to be placed into quotes "" and separated by a | character. Use /all to specify that all projects in the workspace are exported. This parameter must be used with -outputfolder to specify the folder that contains the zips.

nosplash optional launch Capella without the initial splash screen.
consolelog optional allows to send additional log messages (e.g. exceptions) into the console output.
logfile optional defines the path to the log file. If not specified, log file is saved as MDEReport.html in the workspace directory.
help optional prints the help message.


  • When using custom scripts, some arguments may be modified in live. This can cause issues when using paths starting with a "/". If it occurs, try removing the leading "/" from the paths used as arguments.

  • Default behaviour of command line support checks that the workspace specified for use in command line is not in use by another instance of Eclipse.

  • If the path to the aird file or the path to the workspace or the path to the log file contains white space, it should be in quotes (eg: -data “D: /Application Data/workspace”)

  • When Capella is run in command line, logs levels INFO, WARN, ERROR, FATAL are automatically activated for File and Console appender (regardless of the current log configuration stored in %USERPROFILE%/ReportConfiguration.xml)

  • Before running below commands make sure to not have newline between each parameters to avoid copy/paste errors.

Command Line Application Examples

Model Validation

The model validation command line provides the following additional parameters:

Name Category Description
outputfolder mandatory defines the path to the output folder to generate the validation report.
validationruleset optional defines path to the epf file of the disalbed rule IDs
validationcontext optional defines the list of path to objects to validate

Simple use case:

<CapellaInstallationPath>/capellac.exe -nosplash
-application org.polarsys.capella.core.commandline.core
-appid org.polarsys.capella.core.validation.commandline
-data <workspacePath>
-input "/EOLE_AF/EOLE_AF.aird"
-outputfolder /DocProject/validation
-logfile D:/CommandLineLog/log.html


This command validates the model corresponding to the <workspacePath>/EOLE_AF/EOLE_AF.aird file and generates a report to the output folder <workspacePath>/DocProject/validation.

DocProject must be a general Eclipse project (not a directory) initially created into the specified workspace, with inside a folder named validation . As well, EOLE_AF must exist as Capella project inside the same workspace. A log file can be also specified with the parameter -logfile

Complex use case:

<CapellaInstallationPath>/capellac.exe -nosplash
-application org.polarsys.capella.core.commandline.core
-appid org.polarsys.capella.core.validation.commandline
-input /EOLE_AF/EOLE_AF.aird
-outputfolder /DocProject/validation
-validationruleset D:/EPF/exportall.epf
-validationcontext "EOLE_AF/EOLE_AF.capella#971d9934-9780-4e41-b02e-312d0eac3223 | EOLE_AF EOLE_AF/fragments/OA-Operational%20Context-Operational%20Entity.capellafragment#c6aebe52-c8a4-4d35-8105-177c87470bef"
-data <workspacePath>
-logfile D:/CommandLineLog/log.html

This new command uses a -validationruleset parameter to specify the path to an Eclipse Property File (epf file) and a -validationcontext parameter to specify the set of URIs of model elements to validate. The set of rule to validate against are stored into the exported epf file.

The parameter -forceoutputfoldercreation becomes necessary for the following cases :

A log file is also specified.

Migration

Name Category Description
backup optional whether the model is backed up during the migration.
refreshRepresentations optional Force refresh of all representations once the project is migrated. Refresh is performed even if the project was already in the last version.

This command will migrate the project(s) given as input. A workspace folder is created and located where the command is triggered or in a specified path given by the -data parameter. It creates a log file located in the .metadata folder of the workspace. If the input project is a folder, it will be backed up and migrated inside this folder, otherwise if the input is a zip file it will be unzipped and project(s) inside it will be migrated into the workspace folder.

If projects are already migrated to the current version, this command has no effect.

If a project depends of library not listed by input argument, the library is automatically migrated. The command will migrate projects in order according their references.

For a migration and post-migration script example, please check: Migration and Post-Migration script example

Simple use case:

<CapellaInstallationPath>/capellac.exe -nosplash
-application org.polarsys.capella.core.commandline.core
-appid org.polarsys.capella.migration
-data <workspacePath>
-import D:/Projects/EOLE_AF.zip
-input /all
-exportZip EOLE_AF
-outputfolder /MigratedProject/output
-backup

This command imports a .zip into the specified workspace, migrate all projects inside and exported the migrated project as zip to the output folder.

If you migrate a project using libraries, all dependent projects/libraries must be included and the sequence order matters.

Consider the example below:

The migration process must be done according to the following sequence:

  1. Library3
  2. Library1
  3. Library2
  4. Project1

In such a case, the migration sequence can be done either by launching several unary migration commands on each project/library or by giving the whole sequence through the -import parameter (using | separator).

Complex use case:

<CapellaInstallationPath>/capellac.exe -nosplash
-application org.polarsys.capella.core.commandline.core
-appid org.polarsys.capella.migration
-import "D:/Projects/Library3 | D:/Projects/Library1 | D:/Projects/Library2 | D:/Projects/Project1"
-input /all
-data <workspacePath>
-logfile D:/CommandLineLog/log.html

This command migrates the given project/libraries and creates a log.html at the specified location.

Refresh Representations

This command will refresh all representations. More information here: Diagram Refreshing Strategies

Note: This action is also an option in migration command.

Simple use case:

<CapellaInstallationPath>/capellac.exe -nosplash
-application org.polarsys.capella.core.commandline.core
-appid org.polarsys.capella.refreshRepresentations
-data <workspacePath>
-input "/EOLE_AF/EOLE_AF.aird"
-outputfolder "/EOLE_AF/output"

Remove Hidden Elements from Representations

Name Category Description
unsyncDiags optional all the elements with Unsynchronizable and Not synchronized mappings will be removed from diagrams. if not, only elements with Not synchronized mappings will be removed from diagrams.

This command will remove all hidden elements of all representations. More information here: Removing Hidden Elements from Diagrams

Simple use case:

<CapellaInstallationPath>/capellac.exe -nosplash
-application org.polarsys.capella.core.commandline.core
-appid org.polarsys.capella.removeHiddenElements
-data <workspacePath>
-input "/EOLE_AF/EOLE_AF.aird"
-outputfolder "/EOLE_AF/output"

Export Representations as Images

Name Category Description
outputfolder mandatory defines the path to the output folder to export images.
imageFormat optional allows to choose the images format: JPG (by default), PNG, SVG, BMP, GIF
exportToHtml optional an html page for each images
exportDecorations optional for exporting decorations

This command will export images of all representations to the given outputfolder. More information here: Export_As_Image

Simple use case:

<CapellaInstallationPath>/capellac.exe -nosplash
-application org.polarsys.capella.core.commandline.core
-appid org.polarsys.capella.exportRepresentations
-data <workspacePath>
-input "/EOLE_AF/EOLE_AF.aird"
-outputfolder "/EOLE_AF/output"

Export as ZIP (Deprecated, use the parameter -exportZip instead)

This command will export selected project to the given zip filename. Legacy command: All commands contain an export option after execution.

Mandatory parameters:

(usage of “qualifier” in the output file name will be replaced by current date/time)

Simple use case:

<CapellaInstallationPath>/capellac.exe -nosplash
-application org.polarsys.capella.core.commandline.core
-appid org.polarsys.capella.core.commandline.core.exportZip
-data <workspacePath>
-export "EOLE_AF"
-exportZipName "/EOLE_AF/EOLE_qualifier.zip"
-input "/EOLE_AF/EOLE_AF.aird"
-outputfolder "/EOLE_AF/output"
-forceoutputfoldercreation
-logfile D:/CommandLineLog/log.html